
@echo off
echo 🚀 启动DeepSeekOCR-ESG测试平台...
echo =================================

:: 检查Python环境
python --version >nul 2>&1
if errorlevel 1 (
    echo ❌ Python未安装，请先安装Python3.11+
    pause
    exit /b 1
)

:: 检查依赖
echo 📦 检查Python依赖...
cd backend

:: 创建虚拟环境
if not exist "venv" (
    echo 创建虚拟环境...
    python -m venv venv
)

:: 激活虚拟环境
call venv\Scripts\activate

:: 安装依赖
echo 安装依赖包...
pip install -r requirements.txt

:: 创建必要的目录
if not exist "..\data\reports" mkdir "..\data\reports"
if not exist "..\data\annotations" mkdir "..\data\annotations"
if not exist "..\data\results" mkdir "..\data\results"
if not exist "static" mkdir "static"

:: 复制前端文件到static目录
xcopy /E /I /Y "..\frontend\*" "static\"

:: 启动服务
echo 🌐 启动FastAPI服务...
echo 服务地址: http://localhost:8000
echo 测试平台: http://localhost:8000/static/index.html
echo 按Ctrl+C停止服务
echo =================================

uvicorn main:app --host 0.0.0.0 --port 8000 --reload
pause
